package com.common.retrofit.methods;

import com.common.cons.Constans;
import com.common.retrofit.base.BaseMethods;
import com.common.retrofit.entity.bean.UserBean;
import com.common.retrofit.service.HaiNingService;
import com.common.utils.SortUtils;

import rx.Observable;
import rx.Subscriber;

public class ReallyThreeLoginMethods extends BaseMethods {

    private static ReallyThreeLoginMethods m_ins = null;

    public static ReallyThreeLoginMethods getInstance() {
        if (m_ins == null) {
            synchronized (ReallyThreeLoginMethods.class) {
                if (m_ins == null) {
                    m_ins = new ReallyThreeLoginMethods();
                }
            }
        }
        return m_ins;
    }

    @Override
    protected String getHttpUrl() {
        return "Api/User/";
    }

    private HaiNingService initService() {
        return getRetrofit().create(HaiNingService.class);
    }


    public void oauthLogin(Subscriber<UserBean> subscriber
                      ,int thirdType  ,String authId   ,String authName   ,String authHead   ,String jpushid     ) {
        Observable observable = initService().thirdPartyLogin(System.currentTimeMillis()+"",
                SortUtils.getMyHash("thirdType","authId","authName","authHead","jpushid"), Constans.ANDROID_APP_ID,"3",thirdType,authId,authName,authHead,jpushid

        );
        toSubscribe(observable, subscriber);
    }
}
